<template>
  <el-upload
    class="avatar-uploader"
    action="http://localhost:8080/upload"
    :show-file-list="false"
    :on-success="handleAvatarSuccess"
    :before-upload="beforeAvatarUpload"
  >
    <img v-if="imageUrl" :src="imageUrl" class="avatar" />
    <el-icon v-else class="avatar-uploader-icon"><el-button type="primary" style="margin-left: 100px;">文件上传</el-button></el-icon>
  </el-upload>
   
</template>
<script setup>
import { ref } from 'vue'


const imageUrl = ref('')
const beforeAvatarUpload = (file)=>{
    console.log(file)
}

const handleAvatarSuccess = (resp,file)=>{
  console.log(resp);
  imageUrl.value = resp;
    
}





</script>